Language-integrated query (LINQ), and supporting technology, provide a convenient and declarative shorthand query syntax (e.g., SQL-like) to facilitate specification of queries within a programming language (e.g., C#®, Visual Basic® . . . ). More specifically, query operators are provided that map to lower-level language constructs or primitives such as methods and lambda expressions. Query operators are provided for various families of operations (e.g., filtering, projection, joining, grouping, ordering . . . ), and can include but are not limited to “where” and “select” operators that map to methods that implement the operators that these names represent.
In particular, LINQ defines a set of method names (called standard query operators, or standard sequence operators), along with translation rules from query expressions to expressions using these method names, lambda expressions and anonymous types. These can, for example, be used to project and filter data in arrays, enumerable classes, XML (LINQ to XML), relational databases, and third party data sources. By way of example, a user can specify a query in a form such as “from n in numbers where n<10 select n,” wherein “numbers” is a data source and the query returns integers from the data source that are less than ten. Further, query operators can be combined in various ways to generate queries of arbitrary complexity.
Conventionally, LINQ queries have be specified and executed with respect to a relational store. In a relational store or database, data is structured in terms of one or more tables. Tables are relations that comprise a number of columns and rows, wherein the named columns are referred to as attributes and rows capture data for specific entity instances. However, LINQ queries can be extended to support execution over non-relational data such as key-value stores, which maps unique keys to a set of one or more values. More specifically, the key-value store stores values and an index to facilitate location of the stored values based on a key.